<template>
  <div>
    <el-dialog
      title="配置项信息回滚操作"
      width="850px"
      :visible.sync="is_visible"
      :close-on-click-modal="false"
      :append-to-body="true"
    >
         <el-row type="flex" class="row-bg" justify="space-around">
  <el-col :span="7"><div class="grid-content bg-purple">创建人：{{form_data["_source"]["S-creator"]}}</div></el-col>
  <el-col :span="8"><div class="grid-content bg-purple-light">创建时间：{{form_data["_source"]["S-creation-time"]}}</div></el-col>
  <el-col :span="7"><div class="grid-content bg-purple">最后修改人：{{form_data["_source"]["S-last-modified"]}}</div></el-col>
</el-row>
      <el-tabs v-model="activeName">
        <el-tab-pane v-for="(tab_v, tab_k) in tab_pane" :key="tab_v" :label="tab_k" :name="tab_v.toString()">
        <el-form v-for="(item_value,item_key,index) in form_data._source[field_mapping[tab_v]]" :key="index" size="small" :inline="false" label-width="100px" label-position="top">
          <el-col :span="7" style="margin-right:20px">
            <el-form-item  :required="true">
               <b> {{item_key}}：</b>{{item_value}}
            </el-form-item>
          </el-col>
        </el-form>
        </el-tab-pane>
      </el-tabs>
            <center>
      <el-form label-width="0px" style="margin-right: 30px align:center">
      <el-form-item>
        <el-button size="small" style="width: 10%" type="primary" @click="on_submit()">回滚</el-button>
        <el-button size="small" style="width: 10%" type="info"  @click="on_close()" >取消</el-button>
      </el-form-item>
    </el-form>
    </center>
    </el-dialog>
  </div>
</template>

<script>
import { addField, delField, listField } from "@/api/vadmin/cmdb/table";
import { listData,updateData } from "@/api/vadmin/cmdb/data"
export default {
  name: "DetailData",
  components: {},
  data() {
    return {
      is_visible: false,
      loading: false,
      form_data: {"_source":{"jb":{},"sy":{},"ht":{},"wd":{},"wx":{},"gl":{},"bg":{}}},
      field_data: {fields:[]},
      post_data:{},
      field_mapping:{},
      data: {},
      errors: {},
      activeName: 0,
      is_lock:false,
      table: "",
      tab_pane: {
        基本信息: 0,
        私有属性: 1,
        合同信息: 2,
        文档信息: 3,
        维修记录: 4,
        关联关系: 5,
        变更历史: 6,
      },
    };
  },
  created() {
    this.field_mapping=this.$store.state.cmdb.Field_Mapping
  },
  methods: {
    handleClose() {
      this.is_visible = false;
      this.data = false;
      this.$emit("listenChileEvent", 1);
    },
    on_show(data, table) {
      console.log("tttttttttttt",table)
      this.form_data= table
      this.post_data=table
      this.table = table._index;
      this.is_visible = data;
      this.data = this.is_visible;
    },
    on_close(){
      this.is_visible = false;
    }
  },
};
</script>

<style scoped>
</style>
